<template>
    <div>
        <div class="page-title">HSE问题验证</div>
        <div class="page-content">
            <!-- 表单区域 -->
            <el-form
            v-model="filterQuery"
            :model="filterQuery"
            inline>
                <el-form-item label="受检单位">
                    <treeselect
                    placeholder="请输入受检单位"
                    v-model="filterQuery.companyCode"
                    :options="options"
                    style="width: 200px"></treeselect>
                </el-form-item>
                <el-form-item label="审核时间">
                    <el-date-picker
                    placeholder="请输入审核时间"
                    v-model="filterQuery.audittime"
                    style="width: 180px"
                    clearable></el-date-picker>
                </el-form-item>
                <el-form-item label="轮次">
                    <el-input 
                    placeholder="请输入轮次"
                    v-model="filterQuery.round"
                    style="width: 150px"
                    clearable></el-input>
                </el-form-item>
                <el-button type="primary" style="width: 100px" @click="handleSearch">查 询</el-button>
            </el-form>
            <!-- 表格区域 -->
            <el-table
            :data="tableData"
            :header-cell-style="{'text-align':'center'}"
            :cell-style="{'text-align':'center'}"
            style="width: 100%"
            border>
                <el-table-column 
                type="index" 
                label="序号"
                min-width="80px">
                </el-table-column>
                <el-table-column 
                label="审核时间" 
                prop="auditTime"
                min-width="80px">
                </el-table-column>
                <el-table-column 
                label="轮次"
                prop="round"
                min-width="80px">
                </el-table-column>
                <el-table-column
                label="机关处室/二级单位"
                prop="parentCompanyName"
                min-width="100px">
                </el-table-column>
                <el-table-column
                label="科室/基层单位"
                prop="basicCompanyName"
                min-width="100px">
                </el-table-column>
                <el-table-column
                label="作业队号(集团和公司队号）"
                prop="operationTeamName"
                min-width="100px">
                </el-table-column>
                <el-table-column
                label="责任人"
                prop="responsePersonName"
                min-width="80px">
                </el-table-column>
                <el-table-column
                label="审核主题"
                prop="auditSubject"
                min-width="120px">
                </el-table-column>
                <el-table-column
                label="审核项"
                prop="auditItem"
                min-width="120px">
                </el-table-column>
                <el-table-column
                label="审核内容"
                prop="auditContent"
                :show-overflow-tooltip="true"
                min-width="120px">
                </el-table-column>
                <el-table-column 
                label="操作"
                min-width="80px">
                    <template slot-scope="scope">
                        <el-button type="primary" size="mini" @click="handleVerify(scope.row)">验证</el-button>
                    </template>
                </el-table-column>
            </el-table>


        </div>
    </div>
</template>

<script>
import {GetHSEAuditProblem} from '../../../services/hseAudit'
import { GetCompany } from "../../../services/cq_gettreedata";

export default {
    data() {
        return {
            filterQuery: {},
            tableData: [],
            options: []
        }
    },
    mounted() {
        this.getCompanyData()
        this.handleSearch()
    },
    methods: {
        getCompanyData() {
            GetCompany().then(res => {
                this.options = res.data
            })
        },
        handleSearch() {
            GetHSEAuditProblem(this.filterQuery).then(res => {
                this.tableData = res.data
            })
        },
        handleVerify(row) {
            this.$router.push(
                {
                    path: '/hseAudit/hseProblemVerify/verify',
                    query: {row}
                }
            )
        }
    }
}
</script>

<style>
.el-table th {
    display: table-cell ! important;
}
</style>